package com.xuan.service.pg.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuan.dto.pg.meihua.PgMeiHuaDto;
import com.xuan.mapper.pg.PgMeiHuaMapper;
import com.xuan.pojo.pg.PgMeiHua;
import com.xuan.service.pg.PgMeiHuaService;
import com.xuan.utils.xuan.meihua.MeiHua;
import com.xuan.utils.xuan.meihua.MeiHuaSetting;
import com.xuan.vo.pg.meihua.PgMeiHuaVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * 梅花易数起卦Impl
 */
@Service
public class PgMeiHuaServiceImpl extends ServiceImpl<PgMeiHuaMapper, PgMeiHua> implements PgMeiHuaService {

    /**
     * 开始起卦
     *
     * @param dto 梅花易数起卦数据接收类
     * @return 起卦结果
     */
    @Override
    public PgMeiHuaVo starts(PgMeiHuaDto dto) {

        // 1、拷贝梅花易数起卦设置
        MeiHuaSetting setting = new MeiHuaSetting();
        BeanUtils.copyProperties(dto, setting);

        // 2、梅花易数起卦
        MeiHua meiHua = new MeiHua(setting);

        // 3、返回数据
        PgMeiHuaVo vo = new PgMeiHuaVo();
        BeanUtils.copyProperties(meiHua, vo);
        return vo;

    }


}
